package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-04-02
 */
@RestController
@RequestMapping("/admin/questions")
@Api(tags = "互动问题管理-管理端")
@RequiredArgsConstructor
@Slf4j
public class InteractionAdminQuestionController {
    private final IInteractionQuestionService interactionQuestionService;

    @GetMapping("/page")
    @ApiOperation("分页查询互动问题-管理端")
    public PageDTO<QuestionAdminVO> queryAdminQuestionPage(QuestionAdminPageQuery query) {
        return interactionQuestionService.queryAdminQuestionPage(query);
    }
    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("修改互动问题状态-管理端")
    public void updateQuestionStatus(@PathVariable("id") Long id, @PathVariable("hidden") Boolean hidden) {
        interactionQuestionService.updateQuestionStatus(id, hidden);
    }
    @GetMapping("/{id}")
    @ApiOperation("根据id查询问题详情-管理端")
    public QuestionAdminVO getQuestionById(@PathVariable("id") Long id) {
        return interactionQuestionService.getAdminQuestionById(id);
    }

}
